﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using ShoveEL.Database;

public partial class page_ExecSQLScript : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    #region Web 窗体设计器生成的代码

    override protected void OnInit(EventArgs e)
    {
        RequestLoginPage = this.Request.Url.AbsoluteUri;

        RequestCompetences = Competences.BuildCompetencesList(Competences.Administrator);

        base.OnInit(e);
    }

    #endregion

    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (tbPassword.Text != "shovesfs")
        {
            ShoveEL._Web.JavaScript.Alert(this.Page, "系统密码错误，请向开发商咨询此密码！");

            return;
        }

        if (MSSQL.ExecuteSQLScript(tbSQL.Text))
        {
            ShoveEL._Web.JavaScript.Alert(this.Page, "脚本执行成功！");
        }
        else
        {
            ShoveEL._Web.JavaScript.Alert(this.Page, "脚本执行失败！请检查 SQL 脚本是否符合规范。");
        }
    }
}